Skip to content

feat: add permissions boundary support to Lambda execution role - #10

Merged
javi-null merged 5 commits into
mainfrom
feat/permissions-boundary
Apr 1, 2026
Merged

feat: add permissions boundary support to Lambda execution role#10
javi-null merged 5 commits into
mainfrom
feat/permissions-boundary

Conversation

@javi-null

Copy link
Copy Markdown
Contributor

Summary

  • Adds iam_permissions_boundary variable to the IAM module
  • Applies the boundary via permissions_boundary in aws_iam_role.lambda at role creation time
  • Defaults to empty (disabled) for backwards compatibility — existing deployments are unaffected

Why

The np-agent must set a permissions boundary on every execution role it creates to prevent privilege escalation. Without it, a role with CreateRole + AttachRolePolicy could be used to self-escalate. The boundary is enforced at the IAM level, and iam:DeleteRolePermissionsBoundary is denied by the boundary itself, so the role cannot remove its own protection.

Test plan

  • Deploy a new scope with IAM_PERMISSIONS_BOUNDARY_ARN set — verify the role is created with the boundary attached
  • Deploy a new scope without IAM_PERMISSIONS_BOUNDARY_ARN — verify role creation is unaffected (boundary is null)
  • Verify an existing scope re-apply produces no changes (no boundary drift on existing roles)

🤖 Generated with Claude Code

javi-null and others added 5 commits March 27, 2026 11:18
Introduces iam_permissions_boundary variable so the np-agent can attach
a permissions boundary when creating the Lambda execution role, preventing
privilege escalation at runtime.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…and remove dead scripts

Read use_dedicated_role, role_name_template, role_policies, and dedicated role
ARN/name from the scope-configurations provider instead of NRN. Remove
rollback_iam_policies and delete_iam_role (both unused in workflows, lifecycle
managed by Terraform). Simplify networking_healthy diagnose check to use Lambda
resource-based policy instead of NRN-stored API Gateway ID. Drop stale NRN
references from rollback_alias error messages and create_iam_role NRN write.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…build_context

Source fetch_scope_configuration so scope-level workflows have access to
provider data (AWS account, region, VPC, scope-configurations). Replace
raw echo calls with log info/debug for consistency with the rest of the
codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
IAM policy requires this tag on every Create* API call or the action is
denied. Update all Terraform module locals and the create_iam_role CLI
call to use ManagedBy=custom-scope-role instead of ManagedBy=terraform.
Align test assertions accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@javi-null
javi-null merged commit f4d893b into main Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant